package com.sy.service;

import com.sy.dto.FileExtension;
import com.sy.entity.StudyFile;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Part;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;

public interface StudyFileService {
    /**
     * 上传单个文件
     * @param id
     * @param part
     * @return
     * @throws IOException
     * @throws ServletException
     */
    StudyFile uploadOneFile(Integer id, Part part) throws IOException, ServletException;

    /**
     * 生成文件流
     * @param id
     * @param os
     * @return
     */
    StudyFile getFile(String id, ServletOutputStream os) throws IOException;

    /**
     * 删除学习资料
     * @param fileId
     * @return
     */
    boolean deleteStudyFile(String fileId);
}
